<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <script src="../js/babel.min.js"></script>
</head>
<body>
    <div id="root"></div>

    <script type="text/babel">
        // 通过类的方式定义组件
        class FnHello extends React.Component{
            render(){
                return(
                    <h1>hello,{this.props.name}</h1>
                );
            }
        }

        // 定义一个大的组件, 组合上面的组件
        class HelloAll extends React.Component{
             render(){
                return(
                    <div>
                         <FnHello name='Sara'/>
                         <FnHello name='Tom'/>
                         <FnHello name='Dane'/>
                    </div>
                );
            }
        }
        ReactDOM.render(<HelloAll/>, document.getElementById('root'))

        // 渲染小段组件
        // ReactDOM.render(
        //     <FnHello name="tom" />,
        //     document.getElementById('root')
        // )
    </script>

</body>
</html>